package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_BranchCompanyMoneyRecord 分公司金额记录
 *
 */
public class TestData_TB_BranchCompanyMoneyRecord
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_BranchCompanyMoneyRecord saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_BranchCompany branchCompany
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_BranchCompanyMoneyRecord");
		return (TB_BranchCompanyMoneyRecord)repository.save(newMust(
				branchCompany
			));
	}
	
	public static TB_BranchCompanyMoneyRecord newMust(
		bairui.international.model.domain.jpa.TB_BranchCompany branchCompany
	){
		return new TB_BranchCompanyMoneyRecord(new TB_BranchCompanyMoneyRecord.MustProperties() {
			/** 金额 */
			@Override public Double getMoney(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
			}
			/** 剩余金额 */
			@Override public Double getCurrentMoney(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
			}
			/** 类型 */
			@Override public bairui.international.model.type.Type_BranchCompanyMoneyRecord getType(){
				return bairui.international.model.type.Type_BranchCompanyMoneyRecord.Withdraw;
			}
			/** 分公司 */
			@Override public bairui.international.model.domain.jpa.TB_BranchCompany getBranchCompany(){
				return branchCompany;
			}
			/** 剩余可提现总金额 */
			@Override public Double getCurrentWithdrawMoney(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_BranchCompanyMoneyRecord saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder branchCompanyWithdrawOrder
	,bairui.international.model.domain.jpa.TB_BranchCompany branchCompany
	,bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff
	,bairui.international.model.domain.jpa.TB_ProductOrder productOrder
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_BranchCompanyMoneyRecord");
		return (TB_BranchCompanyMoneyRecord)repository.save(newAll(
				branchCompanyWithdrawOrder
				,branchCompany
				,branchCompanyStaff
				,productOrder
			));
	}
	
	public static TB_BranchCompanyMoneyRecord newAll(
		bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder branchCompanyWithdrawOrder
	,bairui.international.model.domain.jpa.TB_BranchCompany branchCompany
	,bairui.international.model.domain.jpa.TB_BranchCompanyStaff branchCompanyStaff
	,bairui.international.model.domain.jpa.TB_ProductOrder productOrder
	){
		return new TB_BranchCompanyMoneyRecord(
			new TB_BranchCompanyMoneyRecord.MustProperties() {
				/** 金额 */
				@Override public Double getMoney(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
				}
				/** 剩余金额 */
				@Override public Double getCurrentMoney(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
				/** 类型 */
				@Override public bairui.international.model.type.Type_BranchCompanyMoneyRecord getType(){
					return bairui.international.model.type.Type_BranchCompanyMoneyRecord.Withdraw;
				}
				/** 分公司 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompany getBranchCompany(){
					return branchCompany;
				}
				/** 剩余可提现总金额 */
				@Override public Double getCurrentWithdrawMoney(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(0, Long.MAX_VALUE);
				}
			},
			new TB_BranchCompanyMoneyRecord.OptionalSingleProperties() {
				/** 分公司提现单 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompanyWithdrawOrder getBranchCompanyWithdrawOrder(){
					return branchCompanyWithdrawOrder;
				}
				/** 分公司员工 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompanyStaff getBranchCompanyStaff(){
					return branchCompanyStaff;
				}
				/** 产品订单 */
				@Override public bairui.international.model.domain.jpa.TB_ProductOrder getProductOrder(){
					return productOrder;
				}
			}
		);
	}
	

}
